package com.dfrz.controller;

import com.dfrz.common.ResultEnum;
import com.dfrz.entity.Result;
import com.dfrz.service.HistoryService;
import com.dfrz.service.VideoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 29877
 * 历史记录
 */
@RestController
public class HistoryController {
    @Resource
    private HistoryService historyService;

    //获取对应用户的历史记录
    @GetMapping("/getHistory")
    public Result getHistory(Integer uid){
        return Result.success(historyService.getHistory(uid));
    }

    //添加历史记录
    @GetMapping("/addhistory")
    public Result addHistory(Integer uid,Integer vid){
        historyService.addhistory(uid,vid);
        return Result.success(ResultEnum.SUCCESS);
    }
    //删除历史记录
    @GetMapping("/deleteHistory")
    public Result deleteHistory(Integer hid){
        historyService.deletehistory(hid);
        return Result.success(ResultEnum.SUCCESS);
    }
    //删除所有历史记录
    @GetMapping("/deleteall")
    public Result deleteAll(Integer uid){
        historyService.deleteall(uid);
        return Result.success(ResultEnum.SUCCESS);
    }
}
